# SPDX-License-Identifier: GPL-2.0-or-later
# SPDX-FileCopyrightText: 2025 Joshua Murphy <flightgear@joshmurphy.ca>

# Configuration file for the Sphinx documentation builder.
#
# This file only contains a selection of the most common options. For a full
# list see the documentation:
# https://www.sphinx-doc.org/en/master/usage/configuration.html

import os
import sys
sys.path.insert(0, os.path.abspath('.'))

project = 'FlightGear'
copyright = '2025, FlightGear Contributors'
author = ''

url = "https://documentation-a29f0f.gitlab.io/"

# The full version, including alpha/beta/rc tags
release = 'next'

# -- General configuration ---------------------------------------------------

# Add any Sphinx extension module names here, as strings. They can be
# extensions coming with Sphinx (named 'sphinx.ext.*') or your custom
# ones.
extensions = [
    "sphinxcontrib.doxylink",
    "sphinx.ext.todo",
    "extensions.doxygen_pages",
    "extensions.annotate_role"
]

doxygen_root = "./src/doxygen" # this is just a convenience variable
doxylink = {
    "demo": (
        f"{doxygen_root}/html/tagfile.xml",
        "../../doxygen/html",
    ),
}


# Add any paths that contain templates here, relative to this directory.
templates_path = ['templates']

# List of patterns, relative to source directory, that match files and
# directories to ignore when looking for source files.
# This pattern also affects html_static_path and html_extra_path.
exclude_patterns = ['_build', 'Thumbs.db', '.DS_Store', '.venv']

# -- Options for HTML output -------------------------------------------------

# The theme to use for HTML and HTML Help pages.  See the documentation for
# a list of builtin themes.

html_theme = 'sphinx_book_theme'

# Add any paths that contain custom static files (such as style sheets) here,
# relative to this directory. They are copied after the builtin static files,
# so a file named "default.css" will overwrite the builtin "default.css".
html_static_path = ['static']

# Add any extra CSS files here, they are relative to html_static_path
html_css_files = ['css/custom.css']

# Ensure that ".. todo::" admonition directives are rendered in the output.
todo_include_todos = True

html_theme_options = {
    # Setup link to GitLab and allow suggesting edits
    #"repository_url": "https://gitlab.com/flightgear/docs",
    #"repository_branch": "next",
    #"path_to_docs": "src",
    #"use_source_button": True,
    #"use_issues_button": True,
    #"use_edit_page_button": True,

    "logo": {
        "text": f"FlightGear Documentation ({release})",
        "image_light": f"{html_static_path[0]}/images/logo.svg",
        "image_dark": f"{html_static_path[0]}/images/logo.svg",
    },

    #"switcher": {
    #    "json_url": f"{url}/next/_static/switcher.json",
    #},
    #"check_switcher": False # Disable checking for switcher.json, a debugging workaround
}
